package org.cjstudio.holypoopsgrs.model;

import java.util.Date;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class UserRecord {

	@SuppressWarnings("unused")
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Key key;

	@Persistent	public int score;
	@Persistent	public Date scoreDate;

	//    /*
	@Persistent	public UserProfile userProfile;
	//    */


	@Override
	public String toString() {
		return "UserRecord [score=" + score + ", scoreDate=" + scoreDate + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + score;
		result = prime * result + ((scoreDate == null) ? 0 : scoreDate.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		UserRecord other = (UserRecord) obj;
		if (score != other.score)
			return false;
		if (scoreDate == null) {
			if (other.scoreDate != null)
				return false;
		} else if (!scoreDate.equals(other.scoreDate))
			return false;
		return true;
	}

}
